19. Common Questions
Question: Error when catkin_make
: success = move_group.move();
Answer: There was an update of the moveit
success code. Change all success code to (for example)success = static_cast<bool>(move_group.move());
to cast it to boolean.
StackOverflow Link: https://robotics.stackexchange.com/questions/14801/catkin-make-unable-to-build-and-throws-makefile138-recipe-for-target-all-fa
Question: What to do if I get the following error when running the Kuka Arm in Project 2?
[ERROR] Failed to call service calculate_ik
Answer: The default safe_spawner.sh shell script does not start your IK_server.py code. You must start it separately, for example by running this command in a new terminal:
rosrun kuka_arm IK_server.py
Alternatively you can modify the shell script (credit Kyle Stewart-Frantz @kylesf ) in order to start the node automatically.
#! /bin/bash
# This script safely launches ros nodes with buffer time to allow param server population
x-terminal-emulator -e roslaunch kuka_arm target_description.launch &
sleep 3 &&
x-terminal-emulator -e roslaunch kuka_arm cafe.launch &
sleep 3 &&
x-terminal-emulator -e roslaunch kuka_arm spawn_target.launch &
sleep 5 &&
#x-terminal-emulator -e roslaunch kuka_arm inverse_kinematics.launch
roslaunch kuka_arm inverse_kinematics.launch &
sleep 5 &&
x-terminal-emulator -e rosrun kuka_arm IK_server.py
Question: My Gazebo crashed when it first opened.
Answer: Gazebo crashes seem to be a common occurrence. Usually the oldest IT trick in the book, turning it off and on again (or just re-running the command) is enough to fix it.
If this problem continues it may well be due to a lack of VM and/or host resources. Please see other Q/A for recommended VM settings.
Question: My arm moves correctly to the object, but then doesn't move at all towards the drop box. What's going on?
Answer: Several people have noticed strange behavior like this if demo mode is set to false, and you forgot to run your IK_server ROS node. So the likely reason is you forgot to start IK_server. To solve that issue please refer to the previous question.
Question: What to do if an error appears related to not being able to find the ROS path?
ERROR: Rosdep cannot find all required resources to answer your query
Missing resource RoboND-Kinematics-Project/
ROS path [0]=/opt/ros/kinetic/share/ros
ROS path [1]=/opt/ros/kinetic/share
Answer: Probably you're not sourcing the second setup.bash. It should be inside the devel folder inside your catkin workspace. It's best to add it to your .bashrc
file so you don't have to remember every time. Should add a line like this:
source [path to your catkin workspace]/devel/setup.bash
Which, for example, for me looks like this:
source /home/robond/catkin_ws/devel/setup.bash
Question: Do we use the Python environment from RoboND-Python-StarterKit
for project 2 and the other ROS projects?
Answer: No, it won't work in that environment since ROS only uses Python 2.7, but the Starterkit uses v3.6. You should use the VM for project 2 and all ROS-related things.
Question: Why should we use atan2()
function to calculate angles rather than acos()
or asin()
?
Answer: You should use atan2
instead of acos
or asin
. The problem with acos
and asin
is that there can be multiple possible solutions depending what quadrant the coordinate lies in and you don't have enough information to distinguish between them. With atan2
the y
and x
coordinates are supplied separately so it can determine the correct quadrant and hence give the correctly signed output.
For more info see here .
Bonus tip: There seems no consistency between programming languages as to which order y
and x
coordinates are supplied in for atan2
function, so make sure to double check the documentation! For our case in Sympy it is atan2(y, x)
Question: Why are joint 4,6 coordinates not the same as Rviz coordinates if we put joint 4,5,6 at wrist center?
Answer: If we put reference frames for 4,5,6 at joint 5 (or wrist center), X & Y coordinates of 4 & 6 are the same as joint 5. That does not mean our calculation not accurate, it is just because of the way we chose to reference our frame.
Reference frame can be varied based on how we like to put it (logically), hence, the location of joint can be varied accordingly. Rviz provides the actual coordinates of each joint.
Question: Compiling trajectory_sampler fails with "undefined references"
Answer: On Ubuntu 16.04, the solution was to switch gcc version from 4.x to 5
Question: When I am running gazebo/rviz, I get a crash and Ctrl+C does not removes all the processes, what can I do to help on this?
Answer: You can create an alias command like this:
alias kz="killall gazebo & killall gzserver & killall gzclient"
This will help you clean the remaining processes
Question: Are there any special steps needed to print values to the terminal in IK_server.py? I can’t seem to print anything to the terminal using the print function
I am also getting the error [ERROR] [1499202293.690777833, 1144.965000000]: Failed to call service
Answer: Run with this command: rosrun kuka_arm IK_server.py
Question: What to do if I get errors like this when running rosdep install rosdistro?
Answer: Check your package.xml file if any of them throw errors.
Question: What to do if the arm or shelf models don’t load correctly (like in image below)?
Check the model path carefully. Open your .bashrc
file and make sure this line is added:
export GAZEBO_MODEL_PATH=~/catkin_ws/src/RoboND-Kinematics-Project/kuka_arm/models
NB: Make sure there is no space after GAZEBO_MODEL_PATH
else it won’t work correctly. Also don’t forget to restart the terminal or resource the .bashrc
file after you make the changes:
source ~/catkin_ws/devel/setup.bash
Question: Is there any reason that we are using Python 2 instead of 3 for ROS?
Answer: Yes. ROS only supports up to Python 2 officially atm.
Question: When I solve for Inverse Kinematics using the pose from a randomly generated (hit Randomize on joint_state_publisher) RViz model, the first three angles do not always match as the one in the model? Should they match?
Answer No, for the scope of the project, they do not need to. This happens because through out our solution, we use equations that have multiple solutions; the simplest example of this would be a square root that has both positive and negative roots. Our solver gives us one solution and that is all we need as we only care about picking up and placing, not the orientation which is a more complex problem.
Question: When doing the Pick and Place project, clicking continue doesn't give the gripper enough time to close and isn't picking up the cylinder. How do I fix this?
Answer: Insert the following code in line 327 in the /src/trajectory_sampler.cpp
file:
ros::Duration(2.0).sleep();
Then redo catkin_make
.